library(tidyverse)
library(DeclareDesign)
library(rdss)

sims <- 2000
bootstrap_sims <- 2000

source("code/declarations/declaration_12.1a.R")
source("code/declarations/declaration_12.1b.R")
source("code/declarations/declaration_12.1c.R")
source("code/declarations/declaration_12.1d.R")

declaration_12.1 <- model_12.1 + inquiry_12.1 + data_strategy_12.1 + answer_strategy_12.1

diagnosands <- declare_diagnosands(
  bias = mean(estimate - estimand),
  rmse = sqrt(mean((estimate - estimand)^2)),
  power = mean(p.value <= 0.05),
  cost = mean(10 * n_villages + 1 * n_villages * citizens_per_village)
)

diagnosis_12.1 <- diagnose_design(declaration_12.1, diagnosands = diagnosands, sims = sims, bootstrap_sims = bootstrap_sims)

write_rds(diagnosis_12.1, file = "diagnosis_objects/diagnosis_12.1.rds")